#ifndef __VIDEO_CMD_H_
#define __VIDEO_CMD_H_

#include <stdint.h>
#include <pthread.h>

#define VIDEO_ACTION_DATA_MAX_LEN (128)

enum video_action {
    VIDEO_ACTION_NONE = 0,
    VIDEO_ACTION_ROTATER,
    VIDEO_ACTION_MIRROR,
    VIDEO_ACTION_SCALE,
    VIDEO_ACTION_PHOTO,
    VIDEO_ACTION_RECORD, //����ͼ�񱣴��Ԥ��
    VIDEO_ACTION_PLAY,
    VIDEO_ACTION_WHITEBLACK,


    MAX_VIDEO_ACTION_COUNT,
};

enum video_cmd_priority {
    VIDEO_CMD_PRIORITY_NORMAL = 0,
    VIDEO_CMD_PRIORITY_LOW,
    VIDEO_CMD_PRIORITY_HIGH,

    MAX_VIDEO_CMD_PRIORITY_COUNT,
};

enum action_cmd {
    VIDEO_ACTION_CMD_STOP = 0,
    VIDEO_ACTION_SELECT_FILE,
    VIDEO_ACTION_CMD_START,
    VIDEO_ACTION_CMD_PLAYING,
    VIDEO_ACTION_CMD_PAUSE,
    VIDEO_ACTION_CMD_AB_PLAY,

    VIDEO_ACTION_CMD_NONE,

    MAX_VIDEO_CMD_ACTION_COUNT,
};

struct video_cmd {
    enum video_action action;
    
    enum video_cmd_priority priority;

    enum action_cmd action_cmd;
    uint8_t data[VIDEO_ACTION_DATA_MAX_LEN + 1];
    int size;
    int data_total_size;

    pthread_spinlock_t spin;

    int ref_cnt;

    void* handle;
    void (*put_cmd)(void* handle, struct video_cmd* cmd);
};

extern struct video_cmd* video_cmd_alloc(void);
extern void video_cmd_free(struct video_cmd* cmd);
extern void video_cmd_get(struct video_cmd* cmd);
extern void video_cmd_put(struct video_cmd* cmd);

#endif